package ru.amse.baltijsky.javascheme.tree.walker;

import ru.amse.baltijsky.javascheme.node.INode;

/**
 * State of the schema tree traversal.
 * T is the type parameter for the tree base node type.
 */
public class TraversalState<T extends INode> {
    /**
     * The next node in the traversal.
     */
    public T node;
    /**
     * The previous node in the traversal.
     */
    public T prev;
    /**
     * The relationship between the current and the previous node.
     */
    public Rel rel;
    /**
     * The depth of <code>node</code> in the loadTree tree.
     */
    public int depth;

    public TraversalState(T nd, T p, Rel r, int d) {
        node = nd;
        prev = p;
        rel = r;
        depth = d;
    }

    public TraversalState() {
    }

    /**
     * Relationship between the next and the previous traversal node.
     */
    public enum Rel {
        NEXT,
        CHILD,
        ROOT
    }
}
